package com.xxx.corejava.day1104;

import java.util.Scanner;

public class Test2 {

    public static void main(String[] args) {

        Scanner sc=new Scanner(System.in);

        int num=(int)(Math.random()*(1000-0+1))+0;
        System.out.println("num = " + num);

        int i=0;

        do {
            System.out.println("还有"+(10-i)+"次机会，请输入猜的数字[0~1000]:");

            int guessNumber=sc.nextInt();

            if(guessNumber<num){
                System.out.println("太小了，再大一点");
            }

            if(guessNumber>num){
                System.out.println("太大了，再小一点");
            }

            if(guessNumber==num){
                System.out.println("恭喜你，猜对了");
                break;
            }



            i++;
        } while (i<10);


        if(i==10){
            System.out.println("太笨了，下次再来");
        }

    }


}
